package com.project.mapper;

import com.github.pagehelper.PageInfo;
import com.project.bean.RoomBean;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface IRoomMapper {

    @Insert("INSERT INTO t_room(r_address,r_price,r_createDate)\n" +
            "VALUES(#{address},#{price},#{createDate})")
    public void add(RoomBean roomBean);

    @Delete("delete from t_room where pk_roomId = #{id}")
    public void del(int id);

    @Update("update t_room set r_price=#{price} where pk_roomId=#{id}")
    public void update(@Param("id") int id,@Param("price") int price);

    @Select("select * from t_room where pk_roomId=#{id}")
    @ResultMap("roomMap")
    public RoomBean findById(int id);

    public List<RoomBean> findByItem(@Param("address") String address,
                                     @Param("startPrice") Integer startPrice,
                                     @Param("endPrice") Integer endPrice);
}
